<?php $this->load->view('navmenu');?>
<script type="text/javascript" charset="utf-8">
    // dynamic table
jQuery(document).ready(function(){
	
    jQuery('#dyntable').dataTable({
    "sPaginationType": "full_numbers",
    "aaSortingFixed": [[0,'asc']],
    "fnDrawCallback": function(oSettings) {
    jQuery.uniform.update();
    }
    });
});
        
</script>
<div class="maincontent">
        	<div class="contentinner">
                	<center><?php echo $this->session->flashdata('msg'); ?></center>
             <h4 class="widgettitle nomargin shadowed">Tambah BOQ</h4>
                <div class="widgetcontent bordered shadowed nopadding">
                    <form class="stdform stdform2" method="post" action="<?php echo base_url()?>index.php/boq/saveBoq">
                            <p>
                                <label>Bab</label>
                                <span class="field"><select name="id_bab" id="selection2" class="uniformselect">
						<?php foreach($babs as $row):?>
								<option value="<?php echo $row['id'];?>" <?php if($selectedBoq['id_bab'] == $row['id']){ echo 'selected'; }else{}?>><?php echo $row['bab'];?> <?php echo $row['uraian'];?></option>
						<?php endforeach; ?>
                                </select></span>
                            </p>
			    <p>
                                <label>Pay Item</label>
                                <span class="field"><input type="text" name="pay_item" class="input-xlarge" <?php if($selectedBoq != ""){ echo 'value="'.$selectedBoq['pay_item'].'"'; }?>/></span>
                            </p>
			    
			    <p>
                                <label>Uraian</label>
                                <span class="field"><textarea name="uraian" class="input-xlarge"><?php if($selectedBoq != ""){ echo $selectedBoq['uraian']; }?></textarea></span>
                            </p>
			    
			    <p>
                                <label>Satuan</label>
                                <span class="field"><input type="text" name="satuan" class="input-xlarge" <?php if($selectedBoq != ""){ echo 'value="'.$selectedBoq['satuan'].'"'; }?>/></span>
                            </p>
			    
			    <p>
                                <label>Jumlah</label>
                                <span class="field"><input type="text" id="jumlah" name="jumlah" class="input-xlarge" <?php if($selectedBoq != ""){ echo 'value="'.$selectedBoq['jumlah'].'"'; }?>/></span>
                            </p>
			    
			    <p>
                                <label>Harga Satuan</label>
                                <span class="field"><input type="text" id="harga" name="harga_satuan" class="input-xlarge" <?php if($selectedBoq != ""){ echo 'value="'.$selectedBoq['harga_satuan'].'"'; }?>/></span>
                            </p>
			    
			    <p>
                                <label>Total Biaya</label>
                                <span class="field"><input readonly type="text" id="total" class="input-xlarge"/></span>
                            </p>
                                                    
                            <p class="stdformbutton">
                                <button type="submit" class="btn btn-primary">Submit Button</button>
                                <button type="reset" class="btn">Reset Button</button>
                            </p>
                        </form>
                    </div><!--widgetcontent-->
            	<h4 class="widgettitle">Daftar User</h4>
            	<table class="table table-bordered" id="dyntable">
                    <thead>
                        <tr>
                            <th class="center">Pay Item</th>
                            <th class="center">Uraian</th>
                            <th class="center">Satuan</th>
                            <th class="center">Jumlah</th>
                            <th class="center">Harga Satuan</th>
                            <th class="center">Total Biaya</th>
                            <th class="center">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($babs as $row):?>
				<tr class="gradeX">
				    <td class="center"><?=$row['bab']?></td>
				    <td colspan="6"><?=$row['uraian']?></td>
				</tr>
				<?php foreach($this->tools->getBoq($row['id']) as $row1):?>
				
				    <tr class="gradeX">
				<td class="center"><?=$row1['pay_item']?></td>
				<td><?=$row1['uraian']?></td>
				<td class="center"><?=$row1['satuan']?></td>
				<td class="center"><?=$row1['jumlah']?></td>
				<td class="center"><?=$row1['harga_satuan']?></td>
				<td class="center"><?=$row1['jumlah']*$row1['harga_satuan']?></td>
				<td class="center"><a href="<?php echo base_url();?>index.php/boq/boqsList/<?=$row1['pay_item']?>"/><i class="icon-edit"></i></a> | <a href="<?php echo base_url();?>index.php/boq/deleteBoq/<?=$row1['pay_item']?>"><i class="icon-remove"></i></a></td>
			    </tr>
				<?php endforeach;?>

			<?php endforeach;?>
                    </tbody>
                </table>
       
            </div><!--contentinner-->
        </div><!--maincontent-->